package com.android.util;


public class TimeUtils {

    public static long getTimePTHM(String ptHm) {
        long timeLong;

        String time = ptHm;

        time = time.substring(2, time.length());

        if (time.endsWith("H")) {
            //小时
            time = time.substring(0, time.length() - 1);
            timeLong = Integer.parseInt(time) * 60 * 60 * 1000;
        } else {
            //分钟
            String date[] = time.split("H");
            if (date.length > 1) {
                int h = Integer.parseInt(date[0]) * 60 * 60 * 1000;
                int m = Integer.parseInt(date[1].substring(0, date[1].length() - 1)) * 60 * 1000;
                timeLong = h + m;
            } else {
                int m = Integer.parseInt(date[0].substring(0, date[0].length() - 1)) * 60 * 1000;
                timeLong = m;
            }
        }
        return timeLong;
    }
}
